"""
# -*- coding: utf-8 -*-
# @Time : 2023/4/23 3:21
# @Author : LTY
# @File : Serial_TimeSetting.py
# @function : python3.9.2
"""
import serial

port = "COM3"
ser = serial.Serial(port, 9600, timeout=None)
ser.flushInput()  # //清空输入缓冲区


try:
    Serial_code = [b'~', b'\x01', b'\x01', b'\x0c', b'2', b'3', b'0', b'3', b'0', b'8', b'1', b'4', b'3', b'5', b'5', b'0', b'p', b'\xe7']
    Serial_code_2 = b'\x7e\x01\x01\x0c\x32\x33\x30\x33\x30\x38\x31\x34\x33\x35\x35\x30\x70\xe7'
    ser.write(Serial_code_2)
    # print(Serial_code[4])
    # print(type(Serial_code[4]))
    # for i in range(1, len(Serial_code)):
    #     ser.write(Serial_code[i-1])


except KeyboardInterrupt:
    if ser is not None:
        ser.close()